<template>
	<view style="margin-top: 20rpx;">

		<swiper class="card-swiper" :class="dotStyle?'square-dot':'round-dot'" :indicator-dots="true" :circular="true"
			:autoplay="true" interval="5000" duration="500" @change="cardSwiper" indicator-color="#8799a3"
			indicator-active-color="#0081ff">
			<swiper-item v-for="(item,index) in swiperList" :key="index" :class="cardCur==index?'cur':''">
				<view class="swiper-item">
					<image :src="item.bannerImg" mode="aspectFill" ></image>
					
				</view>
			</swiper-item>
		</swiper>
	</view>

	<view style="padding: 20rpx;">
		
		<view style="display: flex;justify-content:start;">
			<view style="width: 300rpx;" @click="all">
				<img style="width: 100%; height: 380rpx;" src="../../static/hong_slices/洗车@2x.png">
			</view>
			<view style="width: 405rpx;">
				<navigator url="/pages/member/member" open-type="navigate">
					<image style="height:186rpx;width: 415rpx;" src="../../static/hong_slices/办卡@2x.png"></image>
				</navigator>
				<navigator url="/pages/wallet/wallet" open-type="navigate">
					<image style="height:186rpx;width: 415rpx;" src="../../static/hong_slices/充值@2x.png"></image>
				</navigator>
			</view>
		</view>
		<!-- 	<view class="bom">
			<view class="case">
				红赛智能洗车关联的公众号
			</view>
			<view class="bom1">
				<view class="bom2">
					<p class="app">红赛科技</p>
					<text>智能科技#智能洗车#无人值守设备</text>
				</view>
				<button>查看</button>
			</view>
		</view> -->
		<view class="zhan">
			<view class="zhan1">
				<h3>自营店推荐</h3>
				<!-- <p class="zhanPi">收藏站点</p>
				<p class="zhanPi">优惠站点</p> -->
			</view>
			<view class="zhan2" @click="all">
				<text>更多</text>
				<view class="zhan3"></view>
			</view>
		</view>
		<view >
			<view class="cu-card article case  " :class="isCard?'no-card':''" v-for="(i,index) in station.slice(0,3)" @click="info(i.siteId,i.siteName)">
				<view class="cu-item  radius shadow-warp bg-white" >
					<view class="title"><view class="text-cut">{{i.siteName}}</view></view>
					<view class="content">
						<image :src="i.img"
						 mode="aspectFill"></image>
						<view class="desc">
							<view class="text-content">{{i.introduce}}</view>
							<view>
								<view class="cu-tag bg-red light sm round" v-if="i.siteState == 0">空闲中</view>
								<view class="cu-tag bg-red light sm round" v-if="i.siteState == 1">使用中</view>
								<view class="cu-tag bg-green light sm round">{{i.businessHours}}营业</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				swiperList: [{
					id: 0,
					type: 'image',
					url: 'https://img.zcool.cn/community/01931c59659405a8012193a37e8d72.png@1280w_1l_2o_100sh.png'
				}, {
					id: 1,
					type: 'image',
					url: 'https://imgs.design006.com/202005/Design006_R8PwaQ3TMS.jpg',
				}, {
					id: 2,
					type: 'image',
					url: 'https://img.tukuppt.com/bg_grid/00/14/74/PJOQxoTdcm.jpg!/fh/350'
				}],
				title: "hongsai",
				current: 0,
				mode: 'default',
				station:[]

				
	
			}
		},
		onLoad() {
			
			uni.request({
				url: 'http://127.0.0.1:9000/site/findAllSite',
				method: 'GET',
				data: {},
				success: res => {
					var rs = res.data.data.sitelist
					console.log(rs);
					rs[0].img = "https://img.zcool.cn/community/01db2060630dee11013e87f41019d5.jpg@1280w_1l_2o_100sh.jpg"
					rs[1].img = "https://ts1.cn.mm.bing.net/th/id/R-C.adc24789fe5acc8336551e112b2e3a78?rik=dn0YhUzfCRam9A&riu=http%3a%2f%2fs3.xchuxing.com%2fxchuxing%2farticle%2f2021%2f06%2f21%2f5667a202106212209274611.jpeg&ehk=oSlx9KZjH52a6cYjw%2flPYQSHE9LuFQEjtVuJsQYkdrs%3d&risl=&pid=ImgRaw&r=0"
					rs[2].img = "https://www.szxilepai.com/uploads/allimg/xlp/wenzhang/20190425/wangdian3.jpg"
					this.station = rs
				},
				fail: () => {},
				complete: () => {}
			});
			
			uni.request({
				url: 'http://127.0.0.1:9000/banner/findAllBanner',
				method: 'POST',
				data: {},
				success: res => {
					var rs = res.data.data.banners
					this.swiperList =rs
					console.log(rs);
					
				},
				fail: () => {},
				complete: () => {}
			});
			
		},
		methods: {
			navigate: function(uri) {
				uni.navigateTo({
					url: `/pages/${uri}`
				})
			},
			change(e) {
				this.current = e.detail.current;
			},
			all(){
				uni.navigateTo({
					url: 'allcart',
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},
			info(id,name){
				uni.navigateTo({
					url: './info?id='+id+'&title='+name,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}
		}


	}
</script>

<style lang="less">
	page{
		background-color: white;
	}
	.text {
		font-size: 17px;
		font-weight: 900;
		padding: 40rpx 20rpx;
	}

	.box {
		display: flex;
		height: 400rpx;
		width: 600rpx;

	}

	.bom {
		border: 4rpx solid #EBEBEB;
		border-radius: 30rpx;
		padding: 0 10rpx;
		margin: 0 10rpx;

		.case {
			font-size: 15px;
			color: #B9B9B9;
			padding: 10rpx;
		}

		.bom1 {
			display: flex;
			padding: 30rpx 20rpx;

			.bom2 {
				.app {
					font-size: 22px;
					font-weight: 500;
				}

				text {
					color: #767676;
				}
			}

			button {
				width: 200rpx;
				height: 80rpx;
				text-align: center;
				line-height: 80rpx;
				font-weight: 600;

				border: 1px solid #4FD04D;
				color: #4FD04D;
			}
		}
	}

	.zhan {
		display: flex;
		justify-content: space-between;
		margin: 40rpx 10rpx;

		.zhan1 {
			display: flex;
			margin-right: 40rpx;
			font-size: 18px;

			.zhanPi {
				margin-right: 30rpx;
			}

		}

		.zhan2 {
			display: flex;

			text {
				font-size: 18px;
				color: #B9B9B9;

			}

			.zhan3 {
				width: 45rpx;
				height: 45rpx;
				position: relative;
				top: 4rpx;
				border-radius: 50%;
				background: url(https://s1.ax1x.com/2023/02/28/ppC2GWT.png) no-repeat;

			}
		}
	}

	.dian {
		display: flex;
		flex-wrap: wrap;

		.dian1 {
			width: 47%;
			margin: 10rpx;

			.oneName {
				width: 340rpx;
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;

			}

			image {
				width: 350rpx;
				height: 250rpx;
				border-radius: 30rpx;
			}

			.addtion {
				font-size: 13px;
				color: #B9B9B9;
			}

			text {
				font-size: 13px;
				color: #B9B9B9;
			}

			.xiao {
				display: flex;
				width: 60%;

				.p_xi {
					width: 240rpx;
					height: 40rpx;

					line-height: 40rpx;
					color: #4EA0FF;
					font-size: 14px;
				}

			}

			.xiao1 {
				image {
					width: 30rpx;
					height: 30rpx;
				}
			}

			.xiao2 {
				float: right;
				position: relative;
				top: -55rpx;
				// image{
				// 	width: 30rpx;
				// 	height: 30rpx;

				// }

			}
		}
	}
</style>
